@ECHO OFF;
SET Pause=true
SET Configuration=Release
SET Platform="Any CPU"

CALL "%VS100COMNTOOLS%vsvars32.bat"
IF ERRORLEVEL 1 GOTO ERROR

:BUILD

ECHO.
ECHO ------------------------------------------
ECHO Build initiated
ECHO ------------------------------------------
ECHO.

CALL msbuild.exe "src\host\DotNETX.CommonWcfHost.sln" /t:Rebuild /p:Configuration=%Configuration%  /p:Platform=%Platform%
CALL msbuild.exe "src\auth\EIA.Authentication.sln" /t:Rebuild /p:Configuration=%Configuration%  /p:Platform=%Platform%
CALL msbuild.exe "src\logic\EIA.WCF.Service.sln" /t:Rebuild /p:Configuration=%Configuration%_Service  /p:Platform=%Platform%

IF ERRORLEVEL 1 GOTO ERROR

IF %Pause%==true PAUSE

:COPY
CALL "copy.bat"

IF ERRORLEVEL 1 GOTO ERROR

IF %Pause%==true PAUSE
GOTO END

:ERROR

ECHO.
ECHO ------------------------------------------
ECHO An error occured while updating the library - %ERRORLEVEL%
ECHO ------------------------------------------
ECHO.

IF %Pause%==true PAUSE
ECHO ON
@EXIT /B ERRORLEVEL

:END